
// ref()对应 state
// computed() 对应 getters
// function() 对应 actions

import { ref, computed } from 'vue'
import { defineStore } from 'pinia'

export const useCounterStore = defineStore('counter', () => {

  const names = ref("李四");

  const device_pcs = ref({
    PA: "002",
    PB: 2,
    PC: 0
  });

  let test_arr=ref([11103,0,45]);

  const names_getter = computed(() => names.value)


  function ch_action(name) {
    names.value = name   //必须使用.value
  };

  function ch_device(obj) {
    device_pcs.value = obj;
  }

  function ch_test_arr(obj_arr){
    test_arr.value=obj_arr;
  }

  return { names, names_getter,test_arr, device_pcs,ch_action, ch_device,ch_test_arr }
  
});
